home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / BeanInfo.java < prev    next >
Text File  |  1998-09-22  |  6KB  |  153 lines

  1. /*
  2.  * @(#)BeanInfo.java    1.19 98/07/01
  3.  *
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.beans;
  16.  
  17. /**
  18.  * A bean implementor who wishes to provide explicit information about
  19.  * their bean may provide a BeanInfo class that implements this BeanInfo
  20.  * interface and provides explicit information about the methods,
  21.  * properties, events, etc, of their  bean.
  22.  * <p>
  23.  * A bean implementor doesn't need to provide a complete set of
  24.  * explicit information.  You can pick and choose which information
  25.  * you want to provide and the rest will be obtained by automatic
  26.  * analysis using low-level reflection of the bean classes' methods
  27.  * and applying standard design patterns.
  28.  * <p>
  29.  * You get the opportunity to provide lots and lots of different
  30.  * information as part of the various XyZDescriptor classes.  But
  31.  * don't panic, you only really need to provide the minimal core
  32.  * information required by the various constructors.
  33.  * <P>
  34.  * See also the SimpleBeanInfo class which provides a convenient
  35.  * "noop" base class for BeanInfo classes, which you can override
  36.  * for those specific places where you want to return explicit info.
  37.  * <P>
  38.  * To learn about all the behaviour of a bean see the Introspector class.
  39.  */
  40.  
  41. public interface BeanInfo {
  42.  
  43.     /**
  44.      * @return  A BeanDescriptor providing overall information about
  45.      * the bean, such as its displayName, its customizer, etc.  May
  46.      * return null if the information should be obtained by automatic
  47.      * analysis.
  48.      */
  49.     BeanDescriptor getBeanDescriptor();
  50.     
  51.     /**
  52.      * @return  An array of EventSetDescriptors describing the kinds of 
  53.      * events fired by this bean.  May return null if the information
  54.      * should be obtained by automatic analysis.
  55.      */
  56.     EventSetDescriptor[] getEventSetDescriptors();
  57.  
  58.     /**
  59.      * A bean may have a "default" event that is the event that will
  60.      * mostly commonly be used by human's when using the bean. 
  61.      * @return Index of default event in the EventSetDescriptor array
  62.      *        returned by getEventSetDescriptors.
  63.      * <P>    Returns -1 if there is no default event.
  64.      */
  65.     int getDefaultEventIndex();
  66.  
  67.     /**
  68.      * @return An array of PropertyDescriptors describing the editable
  69.      * properties supported by this bean.  May return null if the
  70.      * information should be obtained by automatic analysis.
  71.      * <p>
  72.      * If a property is indexed, then its entry in the result array will
  73.      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
  74.      * A client of getPropertyDescriptors can use "instanceof" to check
  75.      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
  76.      */
  77.     PropertyDescriptor[] getPropertyDescriptors();
  78.  
  79.     /**
  80.      * A bean may have a "default" property that is the property that will
  81.      * mostly commonly be initially chosen for update by human's who are 
  82.      * customizing the bean.
  83.      * @return  Index of default property in the PropertyDescriptor array
  84.      *         returned by getPropertyDescriptors.
  85.      * <P>    Returns -1 if there is no default property.
  86.      */
  87.     int getDefaultPropertyIndex();
  88.  
  89.     /**
  90.      * @return An array of MethodDescriptors describing the externally
  91.      * visible methods supported by this bean.  May return null if
  92.      * the information should be obtained by automatic analysis.
  93.      */
  94.     MethodDescriptor[] getMethodDescriptors();
  95.  
  96.     /**
  97.      * This method allows a BeanInfo object to return an arbitrary collection
  98.      * of other BeanInfo objects that provide additional information on the
  99.      * current bean.
  100.      * <P>
  101.      * If there are conflicts or overlaps between the information provided
  102.      * by different BeanInfo objects, then the current BeanInfo takes precedence
  103.      * over the getAdditionalBeanInfo objects, and later elements in the array
  104.      * take precedence over earlier ones.
  105.      *
  106.      * @return an array of BeanInfo objects.  May return null.
  107.      */
  108.     BeanInfo[] getAdditionalBeanInfo();
  109.  
  110.     /**
  111.      * This method returns an image object that can be used to
  112.      * represent the bean in toolboxes, toolbars, etc.   Icon images
  113.      * will typically be GIFs, but may in future include other formats.
  114.      * <p>
  115.      * Beans aren't required to provide icons and may return null from
  116.      * this method.
  117.      * <p>
  118.      * There are four possible flavors of icons (16x16 color,
  119.      * 32x32 color, 16x16 mono, 32x32 mono).  If a bean choses to only
  120.      * support a single icon we recommend supporting 16x16 color.
  121.      * <p>
  122.      * We recommend that icons have a "transparent" background
  123.      * so they can be rendered onto an existing background.
  124.      *
  125.      * @param  iconKind  The kind of icon requested.  This should be
  126.      *    one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, 
  127.      *    ICON_MONO_16x16, or ICON_MONO_32x32.
  128.      * @return  An image object representing the requested icon.  May
  129.      *    return null if no suitable icon is available.
  130.      */
  131.     java.awt.Image getIcon(int iconKind);
  132.      
  133.     /**
  134.      * Constant to indicate a 16 x 16 color icon.
  135.      */
  136.     final static int ICON_COLOR_16x16 = 1;
  137.  
  138.     /**
  139.      * Constant to indicate a 32 x 32 color icon.
  140.      */
  141.     final static int ICON_COLOR_32x32 = 2;
  142.  
  143.     /**
  144.      * Constant to indicate a 16 x 16 monochrome icon.
  145.      */
  146.     final static int ICON_MONO_16x16 = 3;
  147.  
  148.     /**
  149.      * Constant to indicate a 32 x 32 monochrome icon.
  150.      */
  151.     final static int ICON_MONO_32x32 = 4;
  152. }
  153.